{template 'web/_header'}
<ul class="nav nav-tabs">
    <li {if ($_GPC['p'] == 'list' || $_GPC['p'] == '') && ($_GPC['op'] == '' || $_GPC['op'] == 'display')}class="active"{/if}><a href="{php echo $this->createWebUrl('gift/list')}">礼品充值记录</a></li>
    <li {if $_GPC['p'] == 'list' && $_GPC['op'] == 'pay_log'}class="active"{/if}><a href="{php echo $this->createWebUrl('gift/list',array('op'=>'pay_log'))}">礼品抵扣记录</a></li>
    <li {if $_GPC['op'] == 'gift_records'}class="active"{/if}><a href="{php echo $this->createWebUrl('gift/list',array('op'=>'gift_records'))}">礼品赠送记录</a></li>
    <li {if $_GPC['op'] == 'style'}class="active"{/if}><a href="{php echo $this->createWebUrl('gift/list',array('op'=>'style'))}">赠送样式</a></li>
    <li {if $_GPC['op'] == 'style_setup'}class="active"{/if}><a href="{php echo $this->createWebUrl('gift/list',array('op'=>'style_setup'))}">样式设置</a></li>
</ul>
{if $operation == 'display'}
     <form action="" method="post">
     <div class="panel panel-info">
    <div class="panel-heading">筛选</div>
	<div class="panel-body">
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">会员信息</label>
                <div class="col-sm-8 col-lg-6 col-xs-12">
                    <input type="text" class="form-control"  name="realname" value="{$_GPC['realname']}" placeholder="可搜索微信号/姓名/呢称/手机号"/> 
                </div>
                <div class="col-sm-7 col-lg-3 col-xs-12">
                                <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                                <input type="hidden" name="token" value="{$_W['token']}" />
                                <button type="submit" name="export" value="1" class="btn btn-primary">导出 Excel</button>
		</div>
            </div>
	</div>
	</div>
<div class="panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th style="width:10%;">ID</th>
                    <th style='width:10%'>充值时间</th>
                    <th style='width:10%'>呢称</th>
                    <th style='width:10%'>微信号</th>
                    <th style='width:10%'>姓名</th>
                    <th style='width:10%'>手机号码</th>
                    <th style='width:10%'>充值金额</th>
                    <th style='width:10%'>性别</th>
                    <th style='width:10%'>所在城市</th>
                    <th style='width:10%'>内容</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>
                    <td>{$row['id']}</td>
                    <td>{$row['createtime']} </td>
                    <td>{$row['nickname']} </td>
                    <td>{$row['weixin']}</td>
                    <td>{$row['realname']}</td>
                    <td>{$row['mobile']}</td>
                    <td>{$row['num']}</td>
                    <td>
                     {if $row['gender']==1}
                      男
                      {else}
                      女
                      {/if}
                    </td>
                    <td>{$row['province']} {$row['city']} {$row['area']}</td>
                    <td>{$row['remark']}</td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
</form>
<script>
    require(['bootstrap'], function ($) {
        $('.btn').hover(function () {
            $(this).tooltip('show');
        }, function () {
            $(this).tooltip('hide');
        });
    });
</script>
{elseif $operation == 'pay_log'}
     <form action="" method="post">
     <div class="panel panel-info">
    <div class="panel-heading">筛选</div>
	<div class="panel-body">
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">会员信息</label>
                <div class="col-sm-8 col-lg-6 col-xs-12">
                    <input type="text" class="form-control"  name="realname" value="{$_GPC['realname']}" placeholder="可搜索微信号/姓名/呢称/手机号"/> 
                </div>
                <div class="col-sm-7 col-lg-3 col-xs-12">
                                <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                                <input type="hidden" name="token" value="{$_W['token']}" />
                                <button type="submit" name="export" value="1" class="btn btn-primary">导出 Excel</button>
		</div>
            </div>
	</div>
	</div>
<div class="panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th style="width:10%;">ID</th>
                    <th style='width:10%'>时间</th>
                    <th style='width:10%'>呢称</th>
                    <th style='width:10%'>微信号</th>
                    <th style='width:10%'>姓名</th>
                    <th style='width:10%'>手机号码</th>
                    <th style='width:10%'>抵扣金额</th>
                    <th style='width:10%'>性别</th>
                    <th style='width:10%'>所在城市</th>
                    <th style='width:30%'>内容</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>
                    <td>{$row['id']}</td>
                    <td>{$row['createtime']} </td>
                    <td>{$row['nickname']} </td>
                    <td>{$row['weixin']}</td>
                    <td>{$row['realname']}</td>
                    <td>{$row['mobile']}</td>
                    <td>{$row['num']}</td>
                    <td>
                     {if $row['gender']==1}
                      男
                      {else}
                      女
                      {/if}
                    </td>
                    <td>{$row['province']} {$row['city']} {$row['area']}</td>
                    <td>{$row['remark']}</td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
</form>
<script>
    require(['bootstrap'], function ($) {
        $('.btn').hover(function () {
            $(this).tooltip('show');
        }, function () {
            $(this).tooltip('hide');
        });
    });
</script>
{elseif $operation == 'gift_records'}
   <form action="" method="post">
     <div class="panel panel-info">
    <div class="panel-heading">筛选</div>
	<div class="panel-body">
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">会员信息</label>
                <div class="col-sm-8 col-lg-6 col-xs-12">
                    <input type="text" class="form-control"  name="realname" value="{$_GPC['realname']}" placeholder="可搜索创建人呢称/创建人姓名"/> 
                </div>
                <div class="col-sm-7 col-lg-3 col-xs-12">
                                <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                                <input type="hidden" name="token" value="{$_W['token']}" />
                                <button type="submit" name="export" value="1" class="btn btn-primary">导出 Excel</button>
		</div>
            </div>
	</div>
	</div>
<div class="panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th style="width:10%;">ID</th>
                    <th style='width:10%'>创建时间</th>
                    <th style='width:10%'>领取时间</th>
                    <th style='width:10%'>创建人呢称</th>
                    <th style='width:10%'>创建人姓名</th>
                    <th style='width:10%'>领取人呢称</th>
                    <th style='width:10%'>领取人姓名</th>
                    <th style='width:10%'>金额</th>
                    <th style='width:10%'>样式</th>
                    <th style='width:10%'>状态</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>
                    <td>{$row['id']}</td>
                    <td>{$row['createtime']} </td>
                    <td>{$row['gettime']} </td>
                    <td>{$row['nickname']} </td>
                    <td>{$row['realname']} </td>
                    <td>{$row['nickname2']} </td>
                    <td>{$row['realname2']} </td>
                    <td>{$row['money']}</td>
                    <td>{$row['styletitle']}</td>
                    <td>{if $row['status']==1}
                        <label class="label label-danger">已领取</label>
                        {/if}
                        {if $row['status']==0}
                        <label class="label label-info">未领取</label>&nbsp;&nbsp;&nbsp;&nbsp;
                        <button onclick="return confirm('此操作不可恢复，确认吗？'); return false;" type="submit" name="refund" value="{$row['id']}" class="btn btn-primary">退还礼品</button>
                        {/if}
                        {if $row['status']==2}
                        <label class="label label-default">已退还</label>
                        {/if}
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
</form>
<script>
    require(['bootstrap'], function ($) {
        $('.btn').hover(function () {
            $(this).tooltip('show');
        }, function () {
            $(this).tooltip('hide');
        });
    });
</script>
{/if}
{if $operation == 'style'}
<div class="panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th style="width:10%;">ID</th>
                    <th style='width:10%'>样式图片</th>
                    <th style='width:10%'>样式标题</th>
                    <th style='width:10%'>背景颜色</th>
                    <th style='width:10%'>有效期</th>
                    <th style='width:10%'>创建时间</th>
                    <th style='width:10%'>分享标题</th>
                    <th style='width:10%'>分享内容</th>
                    <th style='width:10%'>是否显示</th>
                    <th style='width:10%'>操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>
                    <td>{$row['id']}</td>
                    <td><image src="{php echo tomedia($row['image']);}" style="max-width: 48px; max-height: 48px; border: 1px dotted gray"> </td>
                    <td>{$row['title']} </td>
                    <td><div style="height:30px;width:30px;background:{$row['color']};"></div></td>
                    <td>{$row['endtime']} </td>
                    <td>{$row['createtime']} </td>
                    <td>{$row['sharetitle']} </td>
                    <td>{$row['sharedesc']} </td>
                    <td>
                        {if $row['enabled']==1}
                        <label class="label  label-default label-info">显示</label>
                        {else}
                        <label class="label  label-default">关闭</label>
                        {/if}
                    </td>
                    <td>
                        <a href="{php echo $this->createWebUrl('gift/list', array('op'=>'style_setup', 'id'=>$row['id']));}" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                        <a href="{php echo $this->createWebUrl('gift/list',array('op'=>'del','id'=>$row['id']));}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-times"></i>
                        </a>   
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
</form>
{/if}
{if $operation == 'style_setup'}
<div class="panel panel-info">
	<div class="panel-heading">样式设置</div>
	<div class="panel-body">
		<form action="" method="post" class="form-horizontal" role="form" id="form1">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">样式名称</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="title" id="" type="text" value="{$info['title']}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">样式背景颜色</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="color" id="" type="text" value="{$info['color']}">
                        <span class="help-block">例如背景颜色为红色，则输入：#FF0000</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">有效期</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="endtime" id="" type="text" value="{$info['endtime']}">
                        <span class="help-block">例子：1997-01-01</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">分享标题</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="sharetitle" id="" type="text" value="{$info['sharetitle']}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">分享内容</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="sharedesc" id="" type="text" value="{$info['sharedesc']}">
                    </div>
                </div>
                <div class="form-group">
                        <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">样式图片</label>
                        <div class="col-sm-8 col-lg-9 col-xs-12">
                                {php echo tpl_form_field_image('image',$info['image']);}
                                <span class="help-block">图片建议为600X500</span>
                        </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">是否显示</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <label class="radio-inline">
                            <input type='radio' name='enabled' class="check" value=1' {if $info['enabled']==1}checked{/if} /> 是
                        </label>
                        <label class="radio-inline">
                            <input type='radio' name='enabled' class="check" value=0' {if $info['enabled']==0}checked{/if} /> 否
                        </label>
                    </div>
                </div>
                <div class="form-group">
                        <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                        <button type="submit" name="submit" value="1" class="btn btn-primary">提交</button>
                </div>
            </form>
   </div>
</div>
{/if}
{template 'web/_footer'}